Skip to content

Refactor/reduce misc boost dependencies#1459

Merged
tinko92 merged 9 commits into
boostorg:developfrom
tinko92:refactor/reduce-misc-boost-dependencies
May 22, 2026
Merged

Refactor/reduce misc boost dependencies#1459
tinko92 merged 9 commits into
boostorg:developfrom
tinko92:refactor/reduce-misc-boost-dependencies

Conversation

@tinko92
Copy link
Copy Markdown
Collaborator

@tinko92 tinko92 commented Apr 25, 2026

This PR removes a number of dependencies to other Boost libraries. It is more narrow in scope than the prior #1425 (closed it in favour of this) and cleanly (I hope) separates changes to extensions from changes that go into a release. I tried to limit it to headers and features that have one to one replacements to make it more reviewable. I will add comments where I deviate from that.
Varray was intentionally untouched because I propose to remove it in #1458 and don't want to create merge conflicts. This PR is intended to come after that, if the remove does not happen, I can update this one.

Comment thread include/boost/geometry/srs/projections/impl/dms_parser.hpp
Comment thread include/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp
Comment thread include/boost/geometry/index/detail/algorithms/content.hpp
Comment thread include/boost/geometry/util/series_expansion.hpp
Comment thread include/boost/geometry/index/detail/serialization.hpp
Comment thread include/boost/geometry/srs/projections/impl/pj_auth.hpp
Comment thread test/core/visit.cpp
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reduces Boost.Geometry’s transitive dependencies by replacing assorted Boost utilities (e.g., BOOST_STATIC_ASSERT, Boost.TypeTraits, boost::addressof, boost::array, boost::noncopyable, Boost.Cstdint) with equivalent C++14 standard library facilities across headers, tests, examples, and docs.

Changes:

  • Replace Boost compile-time assertions/type-traits with static_assert and <type_traits> equivalents.
  • Replace boost::addressof/boost::array/Boost.Cstdint with std::addressof/std::array/<cstdint> and adjust includes accordingly.
  • Remove some Boost.Build declared dependencies (notably boost_type_traits) and modernize related docs/examples.

Reviewed changes

Copilot reviewed 116 out of 116 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
test/views/random_access_view.cpp Replace BOOST_STATIC_ASSERT with static_assert and add messages.
test/util/transform_variant.cpp Replace boost::add_pointer with std::add_pointer; adjust includes.
test/util/is_implemented.cpp Remove Boost.TypeTraits include.
test/util/compress_variant.cpp Replace boost::is_same with std::is_same; adjust includes.
test/strategies/segment_intersection_sph.hpp Replace boost::is_same with std::is_same; add <type_traits>.
test/strategies/pythagoras.cpp Replace boost::is_same with std::is_same; add <type_traits>.
test/io/wkt/wkt.cpp Replace boost::is_same with std::is_same.
test/core/visit.cpp Replace BOOST_STATIC_ASSERT with static_assert and messages.
test/algorithms/relate/relate_linear_areal.cpp Replace boost::is_same with std::is_same; add <type_traits>.
test/algorithms/overlay/get_turns_linear_linear.cpp Replace boost::is_same with std::is_same; add <type_traits>.
test/algorithms/overlay/copy_segment_point.cpp Replace boost::array with std::array; add <array>.
test/algorithms/is_valid.cpp Replace boost::is_floating_point with std::is_floating_point; add <type_traits>.
test/algorithms/distance/distance.cpp Replace boost::array with std::array and update traits specialization.
test/algorithms/detail/visit.cpp Replace BOOST_STATIC_ASSERT with static_assert and messages.
index/test/rtree/rtree_values.cpp Replace Boost type traits/addressof with std equivalents; adjust includes.
include/boost/geometry/views/enumerate_view.hpp Add missing <algorithm> include for std::max.
include/boost/geometry/views/detail/geometry_collection_view.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/views/detail/boundary_view/implementation.hpp Replace boost::addressof with std::addressof.
include/boost/geometry/util/series_expansion.hpp Switch boost::array-based coeff containers to std::array; update size handling.
include/boost/geometry/util/range.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/util/calculation_type.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove Boost.StaticAssert include.
include/boost/geometry/strategies/buffer.hpp Replace <cstdint> with <cstddef> for std::size_t usage.
include/boost/geometry/srs/transformation.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/srs/spheroid.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove Boost.StaticAssert include.
include/boost/geometry/srs/sphere.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove Boost.StaticAssert include.
include/boost/geometry/srs/projections/str_cast.hpp Replace boost::remove_cv with std::remove_cv; include <type_traits>.
include/boost/geometry/srs/projections/impl/pj_param.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/srs/projections/impl/pj_gridinfo.hpp Replace Boost integer typedefs with <cstdint> types; modernize asserts.
include/boost/geometry/srs/projections/impl/pj_auth.hpp Add <cstddef> include.
include/boost/geometry/srs/projections/impl/pj_apply_gridshift.hpp Replace Boost integer types/addressof with std equivalents; add headers.
include/boost/geometry/srs/projections/impl/dms_parser.hpp Replace BOOST_STATIC_ASSERT with static_assert; simplify diff constant.
include/boost/geometry/srs/projections/grids.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/io/wkt/read.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/io/svg/svg_mapper.hpp Remove boost::noncopyable; explicitly delete copy constructor.
include/boost/geometry/index/detail/serialization.hpp Replace Boost aligned storage/type traits and addressof usage with std equivalents.
include/boost/geometry/index/detail/rtree/visitors/spatial_query.hpp Replace boost::addressof with std::addressof.
include/boost/geometry/index/detail/rtree/visitors/iterator.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/index/detail/rtree/visitors/distance_query.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/index/detail/rtree/utilities/print.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/index/detail/rtree/rstar/redistribute_elements.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove static_assert header include.
include/boost/geometry/index/detail/rtree/query_iterators.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/index/detail/rtree/pack_create.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/index/detail/rtree/node/weak_dynamic.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/index/detail/rtree/node/variant_dynamic.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/index/detail/rtree/linear/redistribute_elements.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/index/detail/rtree/iterators.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/index/detail/algorithms/sum_for_indexable.hpp Add <cstddef> include for std::size_t.
include/boost/geometry/index/detail/algorithms/smallest_for_indexable.hpp Add <cstddef> include for std::size_t.
include/boost/geometry/index/detail/algorithms/segment_intersection.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/index/detail/algorithms/margin.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/index/detail/algorithms/content.hpp Add <algorithm> and replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/geometries/pointing_segment.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/geometries/point.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove Boost.StaticAssert include.
include/boost/geometry/geometries/concepts/polyhedral_surface_concept.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/geometries/adapted/boost_polygon/ring_proxy.hpp Replace Boost type traits with std equivalents; add <type_traits>.
include/boost/geometry/geometries/adapted/boost_fusion.hpp Replace boost::is_same with std::is_same; remove Boost.TypeTraits include.
include/boost/geometry/extensions/nsphere/index/detail/algorithms/margin.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/nsphere/index/detail/algorithms/content.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/nsphere/core/radius.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/multi/gis/io/wkb/detail/writer.hpp Remove Boost.StaticAssert include.
include/boost/geometry/extensions/multi/gis/io/wkb/detail/parser.hpp Replace Boost integer types with <cstdint> equivalents.
include/boost/geometry/extensions/gis/io/wkb/write_wkb.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove Boost.StaticAssert include.
include/boost/geometry/extensions/gis/io/wkb/utility.hpp Replace Boost integer/static assert with std equivalents; include <cstdint>.
include/boost/geometry/extensions/gis/io/wkb/read_wkb.hpp Replace BOOST_STATIC_ASSERT with static_assert; include <cstdint>.
include/boost/geometry/extensions/gis/io/wkb/detail/writer.hpp Remove Boost.StaticAssert include.
include/boost/geometry/extensions/gis/io/wkb/detail/parser.hpp Replace Boost integer/static assert usage with std equivalents; include <cstdint>.
include/boost/geometry/extensions/gis/io/wkb/detail/ogc.hpp Replace Boost integer types with <cstdint> types.
include/boost/geometry/extensions/gis/io/wkb/detail/endian.hpp Replace Boost integer/static assert usage with std equivalents; include <cstdint>.
include/boost/geometry/extensions/gis/io/shapelib/shape_reader.hpp Remove boost::noncopyable; add deleted copy constructor.
include/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp Remove boost::noncopyable/boost::promote; add promote_t and delete copy ctor.
include/boost/geometry/extensions/gis/io/shapelib/dbf_write_attribute.hpp Remove C-string specializations for DBF write helper.
include/boost/geometry/extensions/gis/io/shapefile/read.hpp Replace Boost integer/static assert usage with std equivalents; include <cstdint>.
include/boost/geometry/extensions/algorithms/distance_info.hpp Remove Boost.StaticAssert include.
include/boost/geometry/extensions/algebra/geometries/vector.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/algebra/geometries/rotation_quaternion.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/algebra/geometries/rotation_matrix.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/algebra/geometries/quaternion.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/algebra/geometries/matrix.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/extensions/algebra/algorithms/detail.hpp Replace BOOST_STATIC_ASSERT with static_assert; remove Boost.StaticAssert include.
include/boost/geometry/core/static_assert.hpp Remove Boost.StaticAssert include.
include/boost/geometry/core/radius.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/core/coordinate_dimension.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/simplify.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/turns/compare_turns.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/touches/implementation.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/sections/sectionalize.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/relate/turns.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/relate/result.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/relate/linear_linear.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/relate/linear_areal.hpp Replace BOOST_STATIC_ASSERT with static_assert; replace boost::addressof; include <memory>.
include/boost/geometry/algorithms/detail/relate/follow_helpers.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/relate/areal_areal.hpp Replace BOOST_STATIC_ASSERT with static_assert; replace boost::addressof; include <memory>.
include/boost/geometry/algorithms/detail/point_on_border.hpp Remove Boost.StaticAssert include.
include/boost/geometry/algorithms/detail/overlay/less_by_segment_ratio.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/overlay/get_turn_info_for_endpoint.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/overlay/get_turn_info.hpp Replace BOOST_STATIC_ASSERT with static_assert.
include/boost/geometry/algorithms/detail/overlay/append_no_dups_or_spikes.hpp Remove Boost.StaticAssert include.
include/boost/geometry/algorithms/detail/is_valid/complement_graph.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/for_each_range.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/distance/segment_to_segment.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/closest_points/segment_to_segment.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/centroid/translating_transformer.hpp Replace boost::addressof with std::addressof; include <memory>.
include/boost/geometry/algorithms/detail/buffer/piece_border.hpp Replace boost::addressof with std::addressof; include <memory>.
extensions/test/gis/io/wkb/read_wkb.cpp Replace Boost uint8 type with std::uint8_t; include <cstdint>.
extensions/test/algorithms/distance_info.cpp Replace boost::is_same with std::is_same; include <type_traits>.
extensions/example/experimental/geometry_of.cpp Replace Boost reference trait with std trait; include <type_traits>.
example/c08_custom_non_std_example.cpp Replace boost::is_const with std::is_const; include <type_traits>.
example/c06_custom_polygon_example.cpp Replace boost::array with std::array; include <array>.
example/c04_b_custom_triangle_example.cpp Replace boost::array with std::array; include <array>.
example/c04_a_custom_triangle_example.cpp Replace boost::array with std::array; include <array>.
doc/src/examples/core/rings.cpp Replace boost::is_same with std::is_same; include <type_traits>.
doc/src/examples/core/ring_type.cpp Replace boost::is_same with std::is_same; include <type_traits>.
doc/src/docutils/tools/support_status/support_status.cpp Replace boost::is_base_of with std::is_base_of; include <type_traits>.
doc/doxy/Doxyfile Remove BOOST_STATIC_ASSERT from Doxygen predefined list.
doc/design_rationale.qbk Replace BOOST_STATIC_ASSERT with static_assert in docs.
build.jam Remove boost_type_traits from declared Boost.Build dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp
Comment thread include/boost/geometry/extensions/gis/io/shapelib/shape_creator.hpp
Comment thread test/algorithms/detail/visit.cpp Outdated
Comment thread test/algorithms/detail/visit.cpp Outdated
Comment thread include/boost/geometry/util/series_expansion.hpp Outdated
Comment thread include/boost/geometry/extensions/gis/io/shapelib/shape_reader.hpp Outdated
Comment thread test/core/visit.cpp Outdated
Comment thread include/boost/geometry/extensions/gis/io/wkb/read_wkb.hpp Outdated
Comment thread build.jam
@tinko92 tinko92 force-pushed the refactor/reduce-misc-boost-dependencies branch from 752effc to 2a099f2 Compare April 25, 2026 12:51
Comment thread include/boost/geometry/algorithms/detail/relate/areal_areal.hpp Outdated
Comment thread include/boost/geometry/extensions/algebra/algorithms/detail.hpp Outdated
Copy link
Copy Markdown
Collaborator

@barendgehrels barendgehrels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 nice, this is very welcome! Thanks!

Also great PR with your own comments and explanations.

One small suggestion from my side.

Are the changes in extensions all in one commit? (The one with extensions in the name)?

@tinko92 tinko92 force-pushed the refactor/reduce-misc-boost-dependencies branch 2 times, most recently from 28cc4e1 to 06d8d98 Compare May 3, 2026 05:09
@tinko92
Copy link
Copy Markdown
Collaborator Author

tinko92 commented May 3, 2026

Thanks for the quick feedback!

Are the changes in extensions all in one commit? (The one with extensions in the name)?

There are three commits touching extensions, each with [extensions] at the start of the commit message. The intent here was to separate different changes (replacing different Boost dependencies) in separate commits, so that e.g. a bisection with b2 all remains doable to identify a change that caused some issue. I hope having all extension commits with this [extensions] tag still works well for the release cherry-picking.

Edit: Sorry for the repeated force pushes, I didn't notice an earlier bad rebase from me.

@tinko92 tinko92 force-pushed the refactor/reduce-misc-boost-dependencies branch 2 times, most recently from c554bcd to f2d0cdb Compare May 3, 2026 06:46
@tinko92 tinko92 requested a review from vissarion May 5, 2026 12:15
@barendgehrels
Copy link
Copy Markdown
Collaborator

hi @tinko92 , can we merge this?

@tinko92
Copy link
Copy Markdown
Collaborator Author

tinko92 commented May 15, 2026

Hi @barendgehrels , I was waiting for a second review by @vissarion because it seemed large but if you think it's ok, I can rebase it on current develop and merge.

@barendgehrels
Copy link
Copy Markdown
Collaborator

Hi @barendgehrels , I was waiting for a second review by @vissarion because it seemed large but if you think it's ok, I can rebase it on current develop and merge.

All right, good point, let's wait until the weekend then.

Copy link
Copy Markdown
Member

@vissarion vissarion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Tinko for this! I am OK with merging. Should you also remove Boost::type_traits from cmake as you did in jam files? I am not sure if we could also remove Boost.Array from cmake/jam after the work you did in this PR.

@tinko92
Copy link
Copy Markdown
Collaborator Author

tinko92 commented May 18, 2026

Should you also remove Boost::type_traits from cmake as you did in jam files?

Thanks, good point, I will try to update it tomorrow (and also resolve the merge conflict).

I am not sure if we could also remove Boost.Array from cmake/jam after the work you did in this PR.

I think, we cannot for this case because Boost.Array is still included for some adopted models which I did not remove since that seems like a breaking change/removing a feature. I do not know if many users of C++14-requiring versions of BG are relying on that feature given the obsolescence of Boost.Array since C++11 but I didn't want to raise that question in this PR to keep the scope limited to pure refactoring.

@tinko92 tinko92 force-pushed the refactor/reduce-misc-boost-dependencies branch from f2d0cdb to 81684e8 Compare May 21, 2026 16:16
@tinko92
Copy link
Copy Markdown
Collaborator Author

tinko92 commented May 22, 2026

I'll merge after another test cmake all run on a local x86 machine.

@tinko92 tinko92 merged commit 0227c60 into boostorg:develop May 22, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants